package net.cyue.web.easyquery.provider.http.servlet.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import net.cyue.web.easyquery.core.util.TaskUtil;
import net.cyue.web.easyquery.provider.http.servlet.HTTPServletProviderTaskType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@WebListener
public class ContextListener implements ServletContextListener {

    private final Logger logger = LoggerFactory.getLogger(this.toString());

    public void contextInitialized(ServletContextEvent sce) {
        this.logger.info("Servlet容器初始化完成");
        // 添加路由
        TaskUtil.runTask(HTTPServletProviderTaskType.ADD_ROUTE, sce.getServletContext());
    }

}
